﻿# For VS2022 and Xcode 12+ support.
cmake_minimum_required(VERSION 3.21)

# Only generate Debug and Release configuration types.
set(CMAKE_CONFIGURATION_TYPES Release)
set(CMAKE_SUPPRESS_REGENERATION TRUE)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
set(CMAKE_INSTALL_DEFAULT_TARGETS "")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
set(TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")

set(HOOKENTRY_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/HookEntry.hpp.in")
set(INJECTHOOKER_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/InjectHooker.cpp.in")

# Project name.
project(PrjInjectHooker)

# 导入 Hooker.cmake
find_package(Hooker PATHS "${CMAKE_CURRENT_SOURCE_DIR}" REQUIRED)
include_directories(${Hooker_INCLUDE_DIRS})
link_directories(${Hooker_LIB_DIRS})

# include boost libs
include(${PROJECT_SOURCE_DIR}/BoostLibsConfig.cmake)
include(${PROJECT_SOURCE_DIR}/Macros.cmake)
# add_subdirectory(${CMAKE_SOURCE_DIR}/Hello)
# add_subdirectory(${CMAKE_SOURCE_DIR}/Math)
add_subdirectory(${CMAKE_SOURCE_DIR}/MemAccessHooker)